version: '3'

services:
  loadbalancer:
    build:
      context: .
      dockerfile: Dockerfile.nginx
    ports:
      - 80:80
      - 443:443
    networks:
      - internal
      - external
    depends_on:
      - flask
      - flask2
      - flask3

  flask:
    build:
      context: .
      dockerfile: Dockerfile
    ports:
      - 5000:5000
    networks:
      - internal

  flask2:
    build:
      context: .
      dockerfile: Dockerfile
    ports:
      - 5002:5000
    networks:
      - internal

  flask3:
    build:
      context: .
      dockerfile: Dockerfile
    ports:
      - 5003:5000
    networks:
      - internal

networks:
  internal:
  external:

